package DieSiedler;

import java.util.Comparator;

/**
 * Vergleicht zwei Felder anhand ihrer Position im Array.
 * @author Sebastian Kummer
 *
 */
public class FelderComperator implements Comparator<RessourcenFeld>{
	
	public int compare(RessourcenFeld arg0, RessourcenFeld arg1) {
		int xDiff = arg0.getX() - arg1.getX();
		if(xDiff != 0){
			return xDiff;
		}
		return arg0.getY() - arg1.getY();
	}
	
	public boolean equals(RessourcenFeld arg0, RessourcenFeld arg1) {
		return compare(arg0,arg1) == 0;
	}
	
}